{% set pypi_name = 'openstackdocstheme' %}
{% set upstream_version = upstream_version('2.2.7') %}
{% set rpm_release = '1' %}
{% set source = url_pypi() %}

Name:           {{ py2name() }}
Version:        {{ py2rpmversion() }}
Release:        {{ py2rpmrelease() }}
Summary:        OpenStack Docs Theme
License:        {{ license('Apache-2.0') }}
Group:          Development/Languages/Python
URL:            https://docs.openstack.org/openstackdocstheme
Source0:        {{ source }}
BuildRequires:  openstack-macros
BuildRequires:  {{ py3('Sphinx') }}
BuildRequires:  {{ py3('dulwich') }}
BuildRequires:  {{ py3('pbr') }}
BuildArch:      noarch

%description
Theme and extension support for Sphinx documentation that is published
to docs.openstack.org. Intended for use by OpenStack projects.

%package -n {{ py2name(py_versions='py3') }}
Summary:        OpenStack Docs Theme
Requires:       {{ py3('Sphinx') }}
Requires:       {{ py3('dulwich') }}

%description -n {{ py2name(py_versions='py3') }}
Theme and extension support for Sphinx documentation that is published
to docs.openstack.org. Intended for use by OpenStack projects.

%prep
%autosetup -p1 -n {{ pypi_name }}-{{ upstream_version }}

# we dont need hacking or pre-commit
sed -i '/^hacking.*/d' test-requirements.txt
sed -i '/^pre-commit.*/d' test-requirements.txt
%py_req_cleanup

%build
%py3_build

%install
%py3_install

%check
python3 setup.py test

%files -n {{ py2name(py_versions='py3') }}
%license LICENSE
%doc README.rst
%{_bindir}/docstheme-build-pdf
%{_bindir}/docstheme-build-translated.sh
%{_bindir}/docstheme-lang-display-name.py
%exclude %{_sysconfdir}/alternatives/*.pyc
%exclude %{_sysconfdir}/alternatives/*.pyo
%{python3_sitelib}/{{ pypi_name }}
%{python3_sitelib}/{{ pypi_name }}-*-py?.?.egg-info

%changelog
